const list = require('./mock/list.json');
const address = require('./mock/address.json');
module.exports = {
    devServer:{
        before(app){
            app.get('/api/list',(req,res) => {
                res.send({
                    code:1,
                    data:list
                })
            })

            app.get('/api/detail',(req,res) => {
                let {id} = req.query;
                let arr = Object.values(list).flat();
                let target = arr.find(item => item.id == id);
                res.send({
                    code:1,
                    data:target
                })
            })
            app.get('/api/address',(req,res) => {
                res.send({
                    code:1,
                    data:address
                })
            })
        }
    }
}